<?php
/**
 * Created by PhpStorm.
 * User: Maycon
 * Date: 09/10/14
 * Time: 15:42
 */
//error_reporting(0);

namespace helpers;

use ConfigBoleto;
use core\App;

App::uses('ConfigBoleto','vendor/Boletos');
class BoletoHelper extends ConfigBoleto
{
    private $prepara_dados_boletos;

    public function mountboleto($param=array())
    {

        //$this->debug(true);
        //carregando variavel de tipo de acesso
        $tipo_acesso = $_SESSION['SYSTEM']['LOCAL'];

        //formatando valores dos boletos
        $taxa_boleto        = $param["VALOR_MULTA"];
        //$valor_desconto   = $param["VALOR_DESCONTO"];
        $valor_cobrado      = number_format($param["VALOR_DOCUMENTO"], 2, ',', '.');
        //$valor_cobrado      = str_replace(".", ",",$valor_cobrado);
        //$valor_boleto     = number_format(($valor_cobrado+$taxa_boleto)-$valor_desconto, 2, ',', '');
        $valor_boleto       = number_format($param["VALOR_FINAL"], 2, ',', '.');

        //carregando nosso numero
        $dadosboleto["nosso_numero"] = $param["NOSSO_NUMERO"];

        //verificando tipo de boleto PF e PJ e carregando codigo do documento
        $dadosboleto["numero_documento"] = $param["DOCUMENTO"];

        //carregando datas de vencimento, emiss�o e novo vencimento
        $dadosboleto["data_vencimento"]          = $param["VENCIMENTO"];
        $dadosboleto["data_vencimento_nova"]     = $param["VENCIMENTO_REAL"];
        $dadosboleto["data_documento"]           = date("d/m/Y");
        $dadosboleto["data_processamento"]       = $param["EMISSAO"];

        //carregando valores do boleto
        $dadosboleto["valor_cobrado"]       = $valor_cobrado;
        $dadosboleto["valor_boleto"]        = $valor_boleto;
        $dadosboleto["taxa_boleto"]         = number_format($taxa_boleto,2,',','.');
        //$dadosboleto["valor_desconto"]    = number_format($valor_desconto,2,',','.');

        //carregando informa��es para o cliente
        $dadosboleto["sacado"]          = $param["RESPONSAVEL"];
        $dadosboleto["endereco_cliente"]          = $param["ENDERECO"];
        $dadosboleto["demonstrativo1"]  = "Mensalidade do Plano de Sa�de";
        $dadosboleto["demonstrativo2"]  = "Parcela ref: ".$param["REFERENCIA"];

        //carregando dados beneficiario e dependentes
        $dadosboleto["demonstrativo3"] = "Contrato: ".$param['CONTRATO'];

        if($param['PF_PJ'] == 'PF')
        {
            $dadosboleto["demonstrativo4"] = "Benefici�rios vinculados a cobran�a:";
            foreach($param['DADOS_DEPENDENTES'] as $value){
                $dadosboleto['demonstrativo5'][] = $value['BENEF_DEP'] . " - ". $value['NOME'];
            }
        }

//        carregando informa��es de pagamentos
        switch($param["NUMERO_BANCO"])
        {
            case '341-7':
            {
                $dadosboleto["local_pagamento"]  = "QUALQUER BANCO AT� O VENCIMENTO, AP�S VENCIMENTO APENAS ITAU";
                break;
            }
            case '001-9':
            {
                $dadosboleto["local_pagamento"] = "QUALQUER BANCO AT� O VENCIMENTO";
                break;
            }
            case '033-7':
            {
                $dadosboleto["local_pagamento"] = "PAGAR PREFERENCIALMENTE EM AG�NCIAS DO SANTANDER";
                break;
            }
            default:
                {
                break;
                }
        }



        if($param['PF_PJ'] == 'PJ')
        {
            $dadosboleto["instrucoes1"] = "Pagar em ag�ncia do Banco SANTANDER, at� 30 dias,";
            $dadosboleto["instrucoes2"] = "ap�s o vencimento.";
            $dadosboleto["instrucoes3"] = "Juros a partir de R$ 8,48 por dia de atraso + Multa de 2,00%";
            $dadosboleto["instrucoes4"] = "";

        } else {
            if($tipo_acesso == 'intermed'){

                $dadosboleto["instrucoes1"] = "Juros ao dia 0,033% Ap�s vencimento, cobrar multa de 2%.";
                $dadosboleto["instrucoes2"] = "N�o receber ap�s 60 dias do vencimento.";
                $dadosboleto["instrucoes3"] = "Atraso superior a 60 dias, consecutivos ou n�o nos �ltimos 12 meses implica ";
                $dadosboleto["instrucoes4"] = "na rescis�o do contrato. INTERMED - O PLANO CHEIO DE SAUDE";

            } else {

                $dadosboleto["instrucoes1"] = "Pag�vel em qualquer ag�ncia banc�ria at� o vencimento";
                $dadosboleto["instrucoes2"] = "Unimed Teresina - Registro ANS N�: 353353";
                $dadosboleto["instrucoes3"] = "";
                $dadosboleto["instrucoes4"] = "";
            }
        }

        $dadosboleto["instrucoes5"] = "Desenvolvido pelo Setor de Tecnologia da Informa��o";

        //carregando dados opcionais
        $dadosboleto["quantidade"] = "";
        $dadosboleto["valor_unitario"] = "";
        $dadosboleto["aceite"] = "N";
        $dadosboleto["especie"] = "R$";

        if($param['PF_PJ'] == 'PF')
        {
            $dadosboleto["especie_doc"] = "RC";
            $dadosboleto["cpf"] = $param["CPF"];;
        } else
        {
            $dadosboleto["especie_doc"] = "RC";
            $dadosboleto["cnpj"] = $param["CNPJ"];;
        }

        // ---------------------- DADOS FIXOS DE CONFIGURA��O DO SEU BOLETO --------------- //

        //carregando dados bancarios do cedente
        $dadosboleto["agencia"] = $param["AGENCIA_CEDENTE"];
        $dadosboleto["conta"] = "";
        //$dadosboleto["conta_dv"] = "4";
        $dadosboleto["carteira"] = $param["CARTEIRA"];

        //carregando informa��es do cedente
        if($tipo_acesso == 'intermed')
        {
            $dadosboleto["identificacao"] = "Intermed";
            $dadosboleto["cpf_cnpj"] = "";
            $dadosboleto["endereco"] = "Av. Frei Serafim, 2053 - Centro";
            $dadosboleto["cidade_uf"] = "Teresina - PI";
            $dadosboleto["cedente"] = "HOSPITAIS E CLINICAS DO PIAUI S/S LTDA";
        } else
        {
            $dadosboleto["identificacao"] = "Unimed";
            $dadosboleto["cpf_cnpj"] = "07.241.136/0001-32";
            $dadosboleto["endereco"] = "Rua S�o Jo�o, 1262";
            $dadosboleto["cidade_uf"] = "Teresina - PI";
            $dadosboleto["cedente"] = "UNIMED TERESINA - COOPERATIVA DE TRABALHO M�DICO";
        }

        //carregando dados para montar o codigo de barra
        $dadosboleto["codigo_barras"] = $param["LINHA_BARRA"];
        $dadosboleto["linha_digitavel"] = $param["LINHA_DIGITAVEL"];
        $dadosboleto["agencia_codigo"] = $param["AGENCIA_CEDENTE"];
        $dadosboleto["nosso_numero"] = $param["NOSSO_NUMERO"];
        $dadosboleto["codigo_banco_com_dv"] = $param["NUMERO_BANCO"];

        //carregando varivel global
        $this->prepara_dados_boletos = $dadosboleto;

        //verificando html para impress�o.
        switch($param["NUMERO_BANCO"])
        {
            case '341-7':
            {
                return $this->viewItauBoleto();
                break;
            }
            case '001-9':
            {
                return $this->viewBBBoleto();
                break;
            }
            case '033-7':
            {
                return $this->viewSantanderBoleto();
                break;
            }
            default:
                {
                break;
                }
        }
    }

    public function viewItauBoleto()
    {

        $cpf_cnpj = isset($this->prepara_dados_boletos["cpf_cnpj"]) ? "<br>CNPJ: ".$this->prepara_dados_boletos["cpf_cnpj"] : "";
        $html =
            '<BODY text=#000000 bgColor=#ffffff topMargin=0 rightMargin=0 >
			<table width=666 cellspacing=0 cellpadding=0 border=0 style="font-size:9px">
			    <tr><td valign=top class=cp_intrucoes><div align="center">Instru��es de Impress�o</div></td></tr>
			    <TR>
			        <TD valign=top class=cp_intrucoes><DIV ALIGN="left">
			            <p>
			                <li>Imprima em impressora jato de tinta (ink jet) ou laser em qualidade normal ou alta (N�o use modo econ�mico).
			                <li>Utilize folha A4 (210 x 297 mm) ou Carta (216 x 279 mm) e margens m�nimas � esquerda e � direita do formul�rio.
			                <li>Corte na linha indicada. N�o rasure, risque, fure ou dobre a regi�o onde se encontra o c�digo de barras.
			                <li>Caso n�o apare�a o c�digo de barras no final, clique em F5 para atualizar esta tela.
			                <li>Caso tenha problemas ao imprimir, copie a seq�encia num�rica abaixo e pague no caixa eletr�nico ou no internet banking:
			</table>
			<BR>
			<table style="border-collapse: collapse;border-spacing: 0;">
			 <tr>
			    <td class=cp align=right width=705 >Recibo do Sacado</td>
			 </tr>
			</table>
			<table style="border-collapse: collapse;border-spacing: 0;">
			    <tr>
			        <td class=cp width=150><span class="campo"><IMG src="'.URL_IMG.'/boletos/logoitau.jpg" width="150" height="40" border=0></span></td>
			        <td width=3 valign=bottom><img height=22 src='.URL_IMG.'/boletos/3.png width=2 border=0></td>
			        <td class=cpt width=58 valign=bottom><div align=center><font class=bc>' .$this->prepara_dados_boletos["codigo_banco_com_dv"]. '</font></div></td>
			        <td width=3 valign=bottom><img height=22 src='.URL_IMG.'/boletos/3.png width=2 border=0></td>
			        <td class=ld align=right width=453 valign=bottom><span class=ld> <span class="campotitulo"> ' .$this->prepara_dados_boletos["linha_digitavel"]. ' </span></span></td>
			    </tr>
			    <tbody>
			    <tr>
			        <td colspan=5><img height=1 src='.URL_IMG.'/boletos/2.png width=704 border=0></td>
			    </tr>
			    </tbody>
			</table>
			<table style="border-collapse: collapse;border-spacing: 0;">
			    <tbody>
			    <tr>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=298 height=13>Cedente</td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=126 height=13>Ag�ncia/C�digo do Cedente</td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=34 height=13>Esp�cie</td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=53 height=13>Quantidade</td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=120 height=13>Nosso n�mero</td>
			    </tr>
			    <tr>
			        <td class=cp valign=top width=298 height=12><span class="campo">' .$this->prepara_dados_boletos["cedente"] . '</span></td>
			        <td class=cp valign=top width=126 height=12><span class="campo"> ' .$this->prepara_dados_boletos["agencia_codigo"] . ' </span></td>
			        <td class=cp valign=top width=34 height=12><span class="campo"> ' .$this->prepara_dados_boletos["especie"] . ' </span></td>
			        <td class=cp valign=top width=53 height=12><span class="campo"> ' .$this->prepara_dados_boletos["quantidade"] . ' </span></td>
			        <td class=cp valign=top align=right width=160 height=12><span class="campo"> ' .$this->prepara_dados_boletos["nosso_numero"] . ' </span></td>
			    </tr>
			    <tr>
			        <td colspan=10 ><img height=1 src='.URL_IMG.'/boletos/2.png width=704 border=0></td>
			    </tr>
			    </tbody>
			</table>
			<table style="border-collapse: collapse;border-spacing: 0;">
			    <tbody>
			    <tr>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=120 height=13>N�mero do documento</td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=132 height=13>CPF/CNPJ</td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=134 height=13>Emiss�o</td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=134 height=13>Vencimento</td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=150 height=13>Valor documento</td>
			    </tr>
			    <tr>
			        <td class=cp valign=top width=120 height=12><span class="campo"> ' .$this->prepara_dados_boletos["numero_documento"] . ' </span></td>
			        <td class=cp valign=top width=132 height=12><span class="campo"> ' .$this->prepara_dados_boletos["cpf_cnpj"] . ' </span></td>
			        <td class=cp valign=top width=134 height=12><span class="campo"> ' .$this->prepara_dados_boletos["data_documento"] . ' </span></td>
			        <td class=cp valign=top width=134 height=12><span class="campo"> ' .$this->prepara_dados_boletos["data_vencimento"] . ' </span></td>
			        <td class=cp valign=top align=right width=150 height=12><span class="campo"> ' .$this->prepara_dados_boletos["valor_cobrado"] . ' </span></td>
			    </tr>
			    <tr>
			        <td colspan=10><img height=1 src='.URL_IMG.'/boletos/2.png width=704 border=0></td>
			    </tr>
			    </tbody>
			</table>
			<table style="border-collapse: collapse;border-spacing: 0;">
			    <tbody>
			    <tr>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=120 height=13>(-) Desconto / Abatimentos</td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=112 height=13>(-) Outras dedu��es</td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=113 height=13>(+) Mora / Multa</td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=113 height=13>(+) Outros acr�scimos</td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=180 height=13>(=) Valor cobrado</td>
			    </tr>
			    <tr>
			        <td class=cp valign=top width=120 height=13><span class="campo"> </span></td>
			        <td class=cp valign=top width=112 height=13 align=right><span class="campo"> '.$this->prepara_dados_boletos["valor_desconto"] .'</span></td>
			        <td class=cp valign=top width=113 height=13 align=right><span class="campo"> '.$this->prepara_dados_boletos["taxa_boleto"] .' </span></td>
			        <td class=cp valign=top width=113 height=13><span class="campo"> </span></td>
			        <td class=cp valign=top width=210 height=13 align=right ><span class="campo"> '.$this->prepara_dados_boletos["valor_boleto"] .'</span></td>
			    </tr>
			    <tr>
			        <td colspan=10><img height=1 src='.URL_IMG.'/boletos/2.png width=704 border=0></td>
			    </tr>
			    </tbody>
			</table>
			<table style="border-collapse: collapse;border-spacing: 0;">
			    <tbody>
			    <tr>
			        <td class=ct valign=top width=7 height=13 rowspan=2 ><img height=39 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=659 height=13>Sacado</td>
			    </tr>
			    <tr>
			        <td class=cp valign=top width=659 height=26> <span class="campo"> '.$this->prepara_dados_boletos["sacado"].' <br>  '.$this->prepara_dados_boletos["endereco_cliente"]. '</span></td>
			    </tr>
			    <tr>
			        <td colspan=10><img height=1 src='.URL_IMG.'/boletos/2.png width=704 border=0></td>
			    </tr>
			    </tbody>
			</table>
			<table style="border-collapse: collapse;border-spacing: 0;">
			    <tbody>
			    <tr>
			        <td class=ct width=7 height=12></td>
			        <td class=ct width=400>Demonstrativo</td>
			        <td class=ct width=7 height=12></td>
			        <td class=ct width=130>Autentica��o mec�nica</td>
			    </tr>
			    <tr>
			        <td width=7></td>
			        <td class=cp width=564><span class="campo"> ' .$this->prepara_dados_boletos["demonstrativo1"] . '<br> ' .$this->prepara_dados_boletos["demonstrativo2"] . '<br>' .$this->prepara_dados_boletos["demonstrativo3"] . '<br><br>'.$this->prepara_dados_boletos["demonstrativo4"] .'<br>' ;for($i=0;$i <= count($this->prepara_dados_boletos["demonstrativo5"]);$i++){
        $html .= $this->prepara_dados_boletos["demonstrativo5"][$i].'<br>';
    }
        $html.= '</span></td>
			        <td width=7></td>
			        <td width=88></td>
			    </tr>
			    </tbody>
			</table>
			<table style="border-collapse: collapse;border-spacing: 0;">
			    <tbody>
			    <tr>
			        <td width=7></td>
			        <td width=500 class=cp><br><br><br></td>
			        <td width=159></td>
			    </tr>
			    </tbody>
			</table>
			<table style="border-collapse: collapse;border-spacing: 0;">
			    <tr>
			        <td class=ct width=666></td>
			    </tr>
			    <tbody>
			    <tr>
			        <td class=ct width=666>
			            <div align=right>Corte na linha pontilhada</div>
			        </td>
			    </tr>
			    <tr>
			        <td class=ct colspan=10><img height=1 src='.URL_IMG.'/boletos/6.png width=704 border=0></td>
			    </tr>
			    </tbody>
			</table>
			<br>
			<table style="border-collapse: collapse;border-spacing: 0;">
			    <tr>
			        <td class=cp width=150><span class="campo"><IMG src="'.URL_IMG.'/boletos/logoitau.jpg" width="150" height="40" border=0></span></td>
			        <td width=3 valign=bottom><img height=22 src='.URL_IMG.'/boletos/3.png width=2 border=0></td>
			        <td class=cpt width=58 valign=bottom><div align=center><font class=bc>' .$this->prepara_dados_boletos["codigo_banco_com_dv"] . '</font></div></td>
			        <td width=3 valign=bottom><img height=22 src='.URL_IMG.'/boletos/3.png width=2 border=0></td>
			        <td class=ld align=right width=453 valign=bottom><span class=ld> <span class="campotitulo"> ' .$this->prepara_dados_boletos["linha_digitavel"] . ' </span></span>
			        </td>
			    </tr>
			    <tbody>
			    <tr>
			       <td colspan=10><img height=1 src='.URL_IMG.'/boletos/2.png width=704 border=0></td>
			    </tr>
			    </tbody>
			</table>
			<table style="border-collapse: collapse;border-spacing: 0;">
			    <tbody>
			    <tr>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=501 height=13>Local de Pagamento</td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=150 height=13>Vencimento</td>
			    </tr>
			    <tr>
			        <td class=cp valign=top width=500 height=12>' .$this->prepara_dados_boletos["local_pagamento"]. '</td>
			        <td class=cp valign=top align=right width=190 height=12><span class="campo"> ' .$this->prepara_dados_boletos["data_vencimento_nova"] . ' </span></td>
			    </tr>
			    <tr>
			        <td colspan=10><img height=1 src='.URL_IMG.'/boletos/2.png width=704 border=0></td>
			    </tr>
			    </tbody>
			</table>
			<table style="border-collapse: collapse;border-spacing: 0;">
			    <tbody>
			    <tr>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=501 height=13>Cedente</td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1border=0></td>
			        <td class=ct valign=top width=150 height=13>Ag�ncia/C�digo Cedente</td>
			    </tr>
			    <tr>
			        <td class=cp valign=top width=472 height=12><span class="campo"> ' .$this->prepara_dados_boletos["cedente"] . ' </span></td>
			        <td class=cp valign=top align=right width=190 height=12><span class="campo"> ' .$this->prepara_dados_boletos["agencia_codigo"] . ' </span></td>
			    </tr>
			    <tr>
			        <td colspan=10><img height=1 src='.URL_IMG.'/boletos/2.png width=704 border=0></td>
			    </tr>
			    </tbody>
			</table>
			<table style="border-collapse: collapse;border-spacing: 0;">
			    <tbody>
			    <tr>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=113 height=13>Data do Documento</td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=153 height=13>N� Documento</td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=62 height=13>Esp�cie Doc.</td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=34 height=13>Aceite</td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=111 height=13>Data Processamento </td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=150 height=13> Nosso N�mero</td>
			    </tr>
			    <tr>
			        <td class=cp valign=top width=113 height=12> <div align=left><span class="campo">' .$this->prepara_dados_boletos["data_documento"] . ' </span></div> </td>
			        <td class=cp valign=top width=153 height=12>  <div align=left><span class="campo">' .$this->prepara_dados_boletos["numero_documento"] . ' </span></div></td>
			        <td class=cp valign=top width=62 height=12>  <div align=left><span class="campo">' .$this->prepara_dados_boletos["especie_doc"] . '  </span></div></td>
			        <td class=cp valign=top width=34 height=12>  <div align=left><span class="campo">' .$this->prepara_dados_boletos["aceite"] . ' </span></div></td>
			        <td class=cp valign=top width=82 height=12>  <div align=left><span class="campo">' .$this->prepara_dados_boletos["data_processamento"] . ' </span></div></td>
			        <td class=cp valign=top align=right width=190 height=12><span class="campo">' .$this->prepara_dados_boletos["nosso_numero"] . '</span></td>
			    </tr>
			    <tr>
			        <td colspan=12><img height=1 src='.URL_IMG.'/boletos/2.png width=704 border=0></td>
			    </tr>
			    </tbody>
			</table>
			<table style="border-collapse: collapse;border-spacing: 0;">
			    <tbody>
			    <tr>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=83 height=13> Uso do Banco </td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=83 height=13> Carteira</td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=53 height=13> Esp�cie</td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=123 height=13> Quantidade</td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=131 height=13>Valor Documento</td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=180 height=13> (=) Valor Documento</td>
			    </tr>
			    <tr>
			        <td valign=top class=cp width=83 height=12 ><div align=left></div></td>
			        <td class=cp valign=top width=83><div align=left> <span class="campo">' .$this->prepara_dados_boletos["carteira"] . '</span></div></td>
			        <td class=cp valign=top width=53><div align=left><span class="campo">' .$this->prepara_dados_boletos["especie"] . '</span></div></td>
			        <td class=cp valign=top width=123><span class="campo">' .$this->prepara_dados_boletos["quantidade"] . ' </span></td>
			        <td class=cp valign=top width=131><span class="campo">' .$this->prepara_dados_boletos["valor_unitario"] . '</span></td>
			        <td class=cp valign=top align=right width=190 height=12><span class="campo">' .$this->prepara_dados_boletos["valor_cobrado"] . '</span></td>
			    </tr>
			    <tr>
			        <td colspan=12><img height=1 src='.URL_IMG.'/boletos/2.png width=704 border=0></td>
			    </tr>
			    </tbody>
			</table>

			<table style="border-collapse: collapse;border-spacing: 0;">
			<tbody>
			    <tr>
			        <td class=ct valign=top width=20 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=488 height=13></td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=83 height=13> Carteira</td>
			    </tr>
			    <tr>

			        <td valign=top width=400 rowspan=5><font class=ct> Instru��es (Texto de responsabilidade do cedente)</font>
			        </td>
			        <td valign=top class=cp width=190 height=12 align=right >'.$this->prepara_dados_boletos["carteira"].'</td>
			    </tr>
			    </tbody>
			</table>

			<table style="border-collapse: collapse;border-spacing: 0;">
			<tbody>
			    <tr>
			        <td class=ct valign=top width=20 height=13 rowspan=2><img height=10 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td width=488 ></td>
			        <td class=ct valign=top height=13 rowspan=2><img height=10 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td><img height=1 src='.URL_IMG.'/boletos/2.png width=192 border=0></td>
			    </tr>
			</tbody>
			</table>


			<table style="border-collapse: collapse;border-spacing: 0;">
			<tbody>
			    <tr>
			        <td class=ct valign=top width=20 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=488 height=13><span class=cp> <FONT class=campo>' .$this->prepara_dados_boletos["instrucoes1"] . '</FONT></span></td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=83 height=13>(-)Outras Dedu��es</td>
			    </tr>
			    <tr>
			        <td valign=top width=400 rowspan=5><span class=cp> <FONT class=campo>' .$this->prepara_dados_boletos["instrucoes2"] . '</FONT></span></td>
			        <td valign=top class=cp width=83 height=12 ><span class=cp></span></td>
			        <td valign=top class=cp width=107 height=12 align=right><span class=cp> '.$this->prepara_dados_boletos["valor_desconto"] .'</span></td>
			    </tr>

			</tbody>
			</table>

			<table style="border-collapse: collapse;border-spacing: 0;">
			<tbody>
			    <tr>
			        <td class=ct valign=top width=20 height=13 rowspan=2><img height=10 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td width=488 ></td>
			        <td class=ct valign=top height=13 rowspan=2><img height=10 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td><img height=1 src='.URL_IMG.'/boletos/2.png width=192 border=0></td>
			    </tr>
			</tbody>
			</table>

			<table style="border-collapse: collapse;border-spacing: 0;">
			<tbody>
			    <tr>
			        <td class=ct valign=top width=20 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=488 height=13><span class=cp> <FONT class=campo>' .$this->prepara_dados_boletos["instrucoes3"] . '</FONT></span></td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=83 height=13> (+) Mora/Multa</td>
			    </tr>
			    <tr>

			        <td valign=top width=400 rowspan=5><span class=cp> <FONT class=campo>' .$this->prepara_dados_boletos["instrucoes4"] . '</FONT></span></td>
			        <td valign=top class=cp width=188 height=12 align=right > ' .$this->prepara_dados_boletos["taxa_boleto"].'</td>
			    </tr>

			</tbody>
			</table>

			<table style="border-collapse: collapse;border-spacing: 0;">
			<tbody>
			    <tr>
			        <td class=ct valign=top width=20 height=13 rowspan=2><img height=10 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td width=488 ></td>
			        <td class=ct valign=top height=13 rowspan=2><img height=10 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td><img height=1 src='.URL_IMG.'/boletos/2.png width=192 border=0></td>
			    </tr>
			</tbody>
			</table>


			<table style="border-collapse: collapse;border-spacing: 0;">
			<tbody>
			    <tr>
			        <td class=ct valign=top width=20 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=488 height=13></td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=100 height=13> (+) Outros Acr�scimos</td>
			    </tr>
			    <tr>
			        <td valign=top width=400 rowspan=5></td>
			        <td valign=top class=cp width=83 height=12 ></td>
			    </tr>

			</tbody>
			</table>

			<table style="border-collapse: collapse;border-spacing: 0;">
			<tbody>
			    <tr>
			        <td class=ct valign=top width=20 height=13 rowspan=2><img height=10 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td width=488 ></td>
			        <td class=ct valign=top height=13 rowspan=2><img height=10 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td><img height=1 src='.URL_IMG.'/boletos/2.png width=192 border=0></td>
			    </tr>
			</tbody>
			</table>


			</table>

			<table style="border-collapse: collapse;border-spacing: 0;">
			<tbody>
			    <tr>
			        <td class=ct valign=top width=20 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=488 height=13><span class=cp> <FONT class=campo>' .$this->prepara_dados_boletos["instrucoes5"] . '</FONT></span></td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=100 height=13> (=) Valor Cobrado</td>
			    </tr>
			    <tr>

			        <td valign=top width=400 rowspan=5></td>
			        <td valign=top class=cp width=190 height=12 align=right >'.$this->prepara_dados_boletos["valor_boleto"].'</td>
			    </tr>
			</tbody>
			</table>


			<table style="border-collapse: collapse;border-spacing: 0;">
			<tbody>
			    <tr>
			        <td colspan=12><img height=1 src='.URL_IMG.'/boletos/2.png width=704 border=0></td>
			    </tr>
			</tbody>
			</table>

			<table style="border-collapse: collapse;border-spacing: 0;">
			<tbody>
			    <tr>
			        <td class=ct valign=top width=20 height=13 rowspan=2><img height=39 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=488 height=13>Sacado</td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=39 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=100 height=13></td>
			    </tr>
			    <tr>
			        <td class=cp valign=top width=450 height=26> <span class="campo"> '.$this->prepara_dados_boletos["sacado"].' <br>  '.$this->prepara_dados_boletos["endereco_cliente"]. '</span></td>
			        <td valign=top class=cp width=83 height=12 ></td>
			    </tr>
			</tbody>
			</table>


			<table style="border-collapse: collapse;border-spacing: 0;">
			<tbody>
			    <tr>
			        <td colspan=12><img height=1 src='.URL_IMG.'/boletos/2.png width=704 border=0></td>
			    </tr>
			</tbody>
			</table>
			<table style="border-collapse: collapse;border-spacing: 0;">
			<tbody>
			    <tr>
			        <td class=ct valign=top width=515 height=13>Sacador/Avalista</td>
			        <td class=ct valign=top width=100 height=13>C�d. Baixa</td>
			    </tr>
			    <tr>
			        <td valign=top width=400 rowspan=5></td>
			        <td valign=top class=cp width=83 height=12 ></td>
			    </tr>
			</tbody>
			</table>
			<br>
			<table style="border-collapse: collapse;border-spacing: 0;">
			    <TBODY>
			    <TR>
			        <TD vAlign=bottom align=left height=50> ' . $this->fbarcode($this->prepara_dados_boletos["codigo_barras"]) . '
			        </TD>
			    </tr>
			    </tbody>
			</table>
			<br>
			<table style="border-collapse: collapse;border-spacing: 0;">
			<body>
			    <tr>
			        <td class=ct colspan=10><img height=1 src='.URL_IMG.'/boletos/6.png width=704 border=0></td>
			    </tr>
			    </tbody>
			</table>
			</BODY>';

        return $html;

    }

    public function viewBBBoleto()
    {
        $cpf_cnpj = isset($this->prepara_dados_boletos["cpf_cnpj"]) ? "<br>CNPJ: ".$this->prepara_dados_boletos["cpf_cnpj"] : "";
        $html =
            '<BODY text=#000000 bgColor=#ffffff topMargin=0 rightMargin=0 >
			<table width=666 cellspacing=0 cellpadding=0 border=0 style="font-size:9px">
			    <tr><td valign=top class=cp_intrucoes><div align="center">Instru��es de Impress�o</div></td></tr>
			    <TR>
			        <TD valign=top class=cp_intrucoes><DIV ALIGN="left">
			            <p>
			                <li>Imprima em impressora jato de tinta (ink jet) ou laser em qualidade normal ou alta (N�o use modo econ�mico).
			                <li>Utilize folha A4 (210 x 297 mm) ou Carta (216 x 279 mm) e margens m�nimas � esquerda e � direita do formul�rio.
			                <li>Corte na linha indicada. N�o rasure, risque, fure ou dobre a regi�o onde se encontra o c�digo de barras.
			                <li>Caso n�o apare�a o c�digo de barras no final, clique em F5 para atualizar esta tela.
			                <li>Caso tenha problemas ao imprimir, copie a seq�encia num�rica abaixo e pague no caixa eletr�nico ou no internet banking:
			</table>
			<BR>
			<table style="border-collapse: collapse;border-spacing: 0;">
			 <tr>
			    <td class=cp align=right width=705 >Recibo do Sacado</td>
			 </tr>
			</table>
			<table style="border-collapse: collapse;border-spacing: 0;">
			    <tr>
			        <td class=cp width=150><span class="campo"><IMG src="'.URL_IMG.'/boletos/logobb.jpg" width="150" height="40" border=0></span></td>
			        <td width=3 valign=bottom><img height=22 src='.URL_IMG.'/boletos/3.png width=2 border=0></td>
			        <td class=cpt width=58 valign=bottom><div align=center><font class=bc>' .$this->prepara_dados_boletos["codigo_banco_com_dv"]. '</font></div></td>
			        <td width=3 valign=bottom><img height=22 src='.URL_IMG.'/boletos/3.png width=2 border=0></td>
			        <td class=ld align=right width=453 valign=bottom><span class=ld> <span class="campotitulo"> ' .$this->prepara_dados_boletos["linha_digitavel"]. ' </span></span></td>
			    </tr>
			    <tbody>
			    <tr>
			        <td colspan=5><img height=1 src='.URL_IMG.'/boletos/2.png width=704 border=0></td>
			    </tr>
			    </tbody>
			</table>
			<table style="border-collapse: collapse;border-spacing: 0;">
			    <tbody>
			    <tr>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=298 height=13>Cedente</td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=126 height=13>Ag�ncia/C�digo do Cedente</td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=34 height=13>Esp�cie</td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=53 height=13>Quantidade</td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=120 height=13>Nosso n�mero</td>
			    </tr>
			    <tr>
			        <td class=cp valign=top width=298 height=12><span class="campo">' .$this->prepara_dados_boletos["cedente"] . '</span></td>
			        <td class=cp valign=top width=126 height=12><span class="campo"> ' .$this->prepara_dados_boletos["agencia_codigo"] . ' </span></td>
			        <td class=cp valign=top width=34 height=12><span class="campo"> ' .$this->prepara_dados_boletos["especie"] . ' </span></td>
			        <td class=cp valign=top width=53 height=12><span class="campo"> ' .$this->prepara_dados_boletos["quantidade"] . ' </span></td>
			        <td class=cp valign=top align=right width=160 height=12><span class="campo"> ' .$this->prepara_dados_boletos["nosso_numero"] . ' </span></td>
			    </tr>
			    <tr>
			        <td colspan=10 ><img height=1 src='.URL_IMG.'/boletos/2.png width=704 border=0></td>
			    </tr>
			    </tbody>
			</table>
			<table style="border-collapse: collapse;border-spacing: 0;">
			    <tbody>
			    <tr>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=120 height=13>N�mero do documento</td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=132 height=13>CPF/CNPJ</td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=134 height=13>Emiss�o</td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=134 height=13>Vencimento</td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=150 height=13>Valor documento</td>
			    </tr>
			    <tr>
			        <td class=cp valign=top width=120 height=12><span class="campo"> ' .$this->prepara_dados_boletos["numero_documento"] . ' </span></td>
			        <td class=cp valign=top width=132 height=12><span class="campo"> ' .$this->prepara_dados_boletos["cpf_cnpj"] . ' </span></td>
			        <td class=cp valign=top width=134 height=12><span class="campo"> ' .$this->prepara_dados_boletos["data_documento"] . ' </span></td>
			        <td class=cp valign=top width=134 height=12><span class="campo"> ' .$this->prepara_dados_boletos["data_vencimento"] . ' </span></td>
			        <td class=cp valign=top align=right width=150 height=12><span class="campo"> ' .$this->prepara_dados_boletos["valor_cobrado"] . ' </span></td>
			    </tr>
			    <tr>
			        <td colspan=10><img height=1 src='.URL_IMG.'/boletos/2.png width=704 border=0></td>
			    </tr>
			    </tbody>
			</table>
			<table style="border-collapse: collapse;border-spacing: 0;">
			    <tbody>
			    <tr>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=120 height=13>(-) Desconto / Abatimentos</td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=112 height=13>(-) Outras dedu��es</td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=113 height=13>(+) Mora / Multa</td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=113 height=13>(+) Outros acr�scimos</td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=180 height=13>(=) Valor cobrado</td>
			    </tr>
			    <tr>
			        <td class=cp valign=top width=120 height=13><span class="campo"> </span></td>
			        <td class=cp valign=top width=112 height=13 align=right><span class="campo"> '.$this->prepara_dados_boletos["valor_desconto"] .'</span></td>
			        <td class=cp valign=top width=113 height=13 align=right><span class="campo"> '.$this->prepara_dados_boletos["taxa_boleto"] .' </span></td>
			        <td class=cp valign=top width=113 height=13><span class="campo"> </span></td>
			        <td class=cp valign=top width=210 height=13 align=right ><span class="campo"> '.$this->prepara_dados_boletos["valor_boleto"] .'</span></td>
			    </tr>
			    <tr>
			        <td colspan=10><img height=1 src='.URL_IMG.'/boletos/2.png width=704 border=0></td>
			    </tr>
			    </tbody>
			</table>
			<table style="border-collapse: collapse;border-spacing: 0;">
			    <tbody>
			    <tr>
			        <td class=ct valign=top width=7 height=13 rowspan=2 ><img height=39 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=659 height=13>Sacado</td>
			    </tr>
			    <tr>
			        <td class=cp valign=top width=659 height=26> <span class="campo"> '.$this->prepara_dados_boletos["sacado"].' <br>  '.$this->prepara_dados_boletos["endereco_cliente"]. '</span></td>
			    </tr>
			    <tr>
			        <td colspan=10><img height=1 src='.URL_IMG.'/boletos/2.png width=704 border=0></td>
			    </tr>
			    </tbody>
			</table>
			<table style="border-collapse: collapse;border-spacing: 0;">
			    <tbody>
			    <tr>
			        <td class=ct width=7 height=12></td>
			        <td class=ct width=400>Demonstrativo</td>
			        <td class=ct width=7 height=12></td>
			        <td class=ct width=130>Autentica��o mec�nica</td>
			    </tr>
			    <tr>
			        <td width=7></td>
			        <td class=cp width=564><span class="campo"> ' .$this->prepara_dados_boletos["demonstrativo1"] . '<br> ' .$this->prepara_dados_boletos["demonstrativo2"] . '<br>' .$this->prepara_dados_boletos["demonstrativo3"] . '<br><br>'.$this->prepara_dados_boletos["demonstrativo4"] .'<br>' ;for($i=0;$i <= count($this->prepara_dados_boletos["demonstrativo5"]);$i++){
        $html .= $this->prepara_dados_boletos["demonstrativo5"][$i].'<br>';
    }
        $html.= '</span></td>
			        <td width=7></td>
			        <td width=88></td>
			    </tr>
			    </tbody>
			</table>
			<table style="border-collapse: collapse;border-spacing: 0;">
			    <tbody>
			    <tr>
			        <td width=7></td>
			        <td width=500 class=cp><br><br><br></td>
			        <td width=159></td>
			    </tr>
			    </tbody>
			</table>
			<table style="border-collapse: collapse;border-spacing: 0;">
			    <tr>
			        <td class=ct width=666></td>
			    </tr>
			    <tbody>
			    <tr>
			        <td class=ct width=666>
			            <div align=right>Corte na linha pontilhada</div>
			        </td>
			    </tr>
			    <tr>
			        <td class=ct colspan=10><img height=1 src='.URL_IMG.'/boletos/6.png width=704 border=0></td>
			    </tr>
			    </tbody>
			</table>
			<br>
			<table style="border-collapse: collapse;border-spacing: 0;">
			    <tr>
			        <td class=cp width=150><span class="campo"><IMG src="'.URL_IMG.'/boletos/logobb.jpg" width="150" height="40" border=0></span></td>
			        <td width=3 valign=bottom><img height=22 src='.URL_IMG.'/boletos/3.png width=2 border=0></td>
			        <td class=cpt width=58 valign=bottom><div align=center><font class=bc>' .$this->prepara_dados_boletos["codigo_banco_com_dv"] . '</font></div></td>
			        <td width=3 valign=bottom><img height=22 src='.URL_IMG.'/boletos/3.png width=2 border=0></td>
			        <td class=ld align=right width=453 valign=bottom><span class=ld> <span class="campotitulo"> ' .$this->prepara_dados_boletos["linha_digitavel"] . ' </span></span>
			        </td>
			    </tr>
			    <tbody>
			    <tr>
			       <td colspan=10><img height=1 src='.URL_IMG.'/boletos/2.png width=704 border=0></td>
			    </tr>
			    </tbody>
			</table>
			<table style="border-collapse: collapse;border-spacing: 0;">
			    <tbody>
			    <tr>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=501 height=13>Local de Pagamento</td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=150 height=13>Vencimento</td>
			    </tr>
			    <tr>
			        <td class=cp valign=top width=500 height=12>' .$this->prepara_dados_boletos["local_pagamento"]. '</td>
			        <td class=cp valign=top align=right width=190 height=12><span class="campo"> ' .$this->prepara_dados_boletos["data_vencimento_nova"] . ' </span></td>
			    </tr>
			    <tr>
			        <td colspan=10><img height=1 src='.URL_IMG.'/boletos/2.png width=704 border=0></td>
			    </tr>
			    </tbody>
			</table>
			<table style="border-collapse: collapse;border-spacing: 0;">
			    <tbody>
			    <tr>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=501 height=13>Cedente</td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1border=0></td>
			        <td class=ct valign=top width=150 height=13>Ag�ncia/C�digo Cedente</td>
			    </tr>
			    <tr>
			        <td class=cp valign=top width=472 height=12><span class="campo"> ' .$this->prepara_dados_boletos["cedente"] . ' </span></td>
			        <td class=cp valign=top align=right width=190 height=12><span class="campo"> ' .$this->prepara_dados_boletos["agencia_codigo"] . ' </span></td>
			    </tr>
			    <tr>
			        <td colspan=10><img height=1 src='.URL_IMG.'/boletos/2.png width=704 border=0></td>
			    </tr>
			    </tbody>
			</table>
			<table style="border-collapse: collapse;border-spacing: 0;">
			    <tbody>
			    <tr>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=113 height=13>Data do Documento</td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=153 height=13>N� Documento</td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=62 height=13>Esp�cie Doc.</td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=34 height=13>Aceite</td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=111 height=13>Data Processamento </td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=150 height=13> Nosso N�mero</td>
			    </tr>
			    <tr>
			        <td class=cp valign=top width=113 height=12> <div align=left><span class="campo">' .$this->prepara_dados_boletos["data_documento"] . ' </span></div> </td>
			        <td class=cp valign=top width=153 height=12>  <div align=left><span class="campo">' .$this->prepara_dados_boletos["numero_documento"] . ' </span></div></td>
			        <td class=cp valign=top width=62 height=12>  <div align=left><span class="campo">' .$this->prepara_dados_boletos["especie_doc"] . '  </span></div></td>
			        <td class=cp valign=top width=34 height=12>  <div align=left><span class="campo">' .$this->prepara_dados_boletos["aceite"] . ' </span></div></td>
			        <td class=cp valign=top width=82 height=12>  <div align=left><span class="campo">' .$this->prepara_dados_boletos["data_processamento"] . ' </span></div></td>
			        <td class=cp valign=top align=right width=190 height=12><span class="campo">' .$this->prepara_dados_boletos["nosso_numero"] . '</span></td>
			    </tr>
			    <tr>
			        <td colspan=12><img height=1 src='.URL_IMG.'/boletos/2.png width=704 border=0></td>
			    </tr>
			    </tbody>
			</table>
			<table style="border-collapse: collapse;border-spacing: 0;">
			    <tbody>
			    <tr>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=83 height=13> Uso do Banco </td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=83 height=13> Carteira</td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=53 height=13> Esp�cie</td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=123 height=13> Quantidade</td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=131 height=13>Valor Documento</td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=180 height=13> (=) Valor Documento</td>
			    </tr>
			    <tr>
			        <td valign=top class=cp width=83 height=12 ><div align=left></div></td>
			        <td class=cp valign=top width=83><div align=left> <span class="campo">' .$this->prepara_dados_boletos["carteira"] . '</span></div></td>
			        <td class=cp valign=top width=53><div align=left><span class="campo">' .$this->prepara_dados_boletos["especie"] . '</span></div></td>
			        <td class=cp valign=top width=123><span class="campo">' .$this->prepara_dados_boletos["quantidade"] . ' </span></td>
			        <td class=cp valign=top width=131><span class="campo">' .$this->prepara_dados_boletos["valor_unitario"] . '</span></td>
			        <td class=cp valign=top align=right width=190 height=12><span class="campo">' .$this->prepara_dados_boletos["valor_cobrado"] . '</span></td>
			    </tr>
			    <tr>
			        <td colspan=12><img height=1 src='.URL_IMG.'/boletos/2.png width=704 border=0></td>
			    </tr>
			    </tbody>
			</table>

			<table style="border-collapse: collapse;border-spacing: 0;">
			<tbody>
			    <tr>
			        <td class=ct valign=top width=20 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=488 height=13></td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=83 height=13> Carteira</td>
			    </tr>
			    <tr>

			        <td valign=top width=400 rowspan=5><font class=ct> Instru��es (Texto de responsabilidade do cedente)</font>
			        </td>
			        <td valign=top class=cp width=190 height=12 align=right >'.$this->prepara_dados_boletos["carteira"].'</td>
			    </tr>
			    </tbody>
			</table>

			<table style="border-collapse: collapse;border-spacing: 0;">
			<tbody>
			    <tr>
			        <td class=ct valign=top width=20 height=13 rowspan=2><img height=10 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td width=488 ></td>
			        <td class=ct valign=top height=13 rowspan=2><img height=10 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td><img height=1 src='.URL_IMG.'/boletos/2.png width=192 border=0></td>
			    </tr>
			</tbody>
			</table>


			<table style="border-collapse: collapse;border-spacing: 0;">
			<tbody>
			    <tr>
			        <td class=ct valign=top width=20 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=488 height=13><span class=cp> <FONT class=campo>' .$this->prepara_dados_boletos["instrucoes1"] . '</FONT></span></td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=83 height=13>(-)Outras Dedu��es</td>
			    </tr>
			    <tr>
			        <td valign=top width=400 rowspan=5><span class=cp> <FONT class=campo>' .$this->prepara_dados_boletos["instrucoes2"] . '</FONT></span></td>
			        <td valign=top class=cp width=83 height=12 ><span class=cp></span></td>
			        <td valign=top class=cp width=107 height=12 align=right><span class=cp> '.$this->prepara_dados_boletos["valor_desconto"] .'</span></td>
			    </tr>

			</tbody>
			</table>

			<table style="border-collapse: collapse;border-spacing: 0;">
			<tbody>
			    <tr>
			        <td class=ct valign=top width=20 height=13 rowspan=2><img height=10 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td width=488 ></td>
			        <td class=ct valign=top height=13 rowspan=2><img height=10 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td><img height=1 src='.URL_IMG.'/boletos/2.png width=192 border=0></td>
			    </tr>
			</tbody>
			</table>

			<table style="border-collapse: collapse;border-spacing: 0;">
			<tbody>
			    <tr>
			        <td class=ct valign=top width=20 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=488 height=13><span class=cp> <FONT class=campo>' .$this->prepara_dados_boletos["instrucoes3"] . '</FONT></span></td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=83 height=13> (+) Mora/Multa</td>
			    </tr>
			    <tr>

			        <td valign=top width=400 rowspan=5><span class=cp> <FONT class=campo>' .$this->prepara_dados_boletos["instrucoes4"] . '</FONT></span></td>
			        <td valign=top class=cp width=188 height=12 align=right > ' .$this->prepara_dados_boletos["taxa_boleto"].'</td>
			    </tr>

			</tbody>
			</table>

			<table style="border-collapse: collapse;border-spacing: 0;">
			<tbody>
			    <tr>
			        <td class=ct valign=top width=20 height=13 rowspan=2><img height=10 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td width=488 ></td>
			        <td class=ct valign=top height=13 rowspan=2><img height=10 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td><img height=1 src='.URL_IMG.'/boletos/2.png width=192 border=0></td>
			    </tr>
			</tbody>
			</table>


			<table style="border-collapse: collapse;border-spacing: 0;">
			<tbody>
			    <tr>
			        <td class=ct valign=top width=20 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=488 height=13></td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=100 height=13> (+) Outros Acr�scimos</td>
			    </tr>
			    <tr>
			        <td valign=top width=400 rowspan=5></td>
			        <td valign=top class=cp width=83 height=12 ></td>
			    </tr>

			</tbody>
			</table>

			<table style="border-collapse: collapse;border-spacing: 0;">
			<tbody>
			    <tr>
			        <td class=ct valign=top width=20 height=13 rowspan=2><img height=10 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td width=488 ></td>
			        <td class=ct valign=top height=13 rowspan=2><img height=10 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td><img height=1 src='.URL_IMG.'/boletos/2.png width=192 border=0></td>
			    </tr>
			</tbody>
			</table>


			</table>

			<table style="border-collapse: collapse;border-spacing: 0;">
			<tbody>
			    <tr>
			        <td class=ct valign=top width=20 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=488 height=13><span class=cp> <FONT class=campo>' .$this->prepara_dados_boletos["instrucoes5"] . '</FONT></span></td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=100 height=13> (=) Valor Cobrado</td>
			    </tr>
			    <tr>

			        <td valign=top width=400 rowspan=5></td>
			        <td valign=top class=cp width=190 height=12 align=right >'.$this->prepara_dados_boletos["valor_boleto"].'</td>
			    </tr>
			</tbody>
			</table>


			<table style="border-collapse: collapse;border-spacing: 0;">
			<tbody>
			    <tr>
			        <td colspan=12><img height=1 src='.URL_IMG.'/boletos/2.png width=704 border=0></td>
			    </tr>
			</tbody>
			</table>

			<table style="border-collapse: collapse;border-spacing: 0;">
			<tbody>
			    <tr>
			        <td class=ct valign=top width=20 height=13 rowspan=2><img height=39 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=488 height=13>Sacado</td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=39 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=100 height=13></td>
			    </tr>
			    <tr>
			        <td class=cp valign=top width=450 height=26> <span class="campo"> '.$this->prepara_dados_boletos["sacado"].' <br>  '.$this->prepara_dados_boletos["endereco_cliente"]. '</span></td>
			        <td valign=top class=cp width=83 height=12 ></td>
			    </tr>
			</tbody>
			</table>


			<table style="border-collapse: collapse;border-spacing: 0;">
			<tbody>
			    <tr>
			        <td colspan=12><img height=1 src='.URL_IMG.'/boletos/2.png width=704 border=0></td>
			    </tr>
			</tbody>
			</table>
			<table style="border-collapse: collapse;border-spacing: 0;">
			<tbody>
			    <tr>
			        <td class=ct valign=top width=515 height=13>Sacador/Avalista</td>
			        <td class=ct valign=top width=100 height=13>C�d. Baixa</td>
			    </tr>
			    <tr>
			        <td valign=top width=400 rowspan=5></td>
			        <td valign=top class=cp width=83 height=12 ></td>
			    </tr>
			</tbody>
			</table>
			<br>
			<table style="border-collapse: collapse;border-spacing: 0;">
			    <TBODY>
			    <TR>
			        <TD vAlign=bottom align=left height=50> ' . $this->fbarcode($this->prepara_dados_boletos["codigo_barras"]) . '
			        </TD>
			    </tr>
			    </tbody>
			</table>
			<br>
			<table style="border-collapse: collapse;border-spacing: 0;">
			<body>
			    <tr>
			        <td class=ct colspan=10><img height=1 src='.URL_IMG.'/boletos/6.png width=704 border=0></td>
			    </tr>
			    </tbody>
			</table>
			</BODY>';

        return $html;
    }

    public function viewSantanderBoleto()
    {
        $cpf_cnpj = isset($this->prepara_dados_boletos["cpf_cnpj"]) ? "<br>CNPJ: ".$this->prepara_dados_boletos["cpf_cnpj"] : "";
        $html =
            '<BODY text=#000000 bgColor=#ffffff topMargin=0 rightMargin=0 >
			<table width=666 cellspacing=0 cellpadding=0 border=0 style="font-size:9px">
			    <tr><td valign=top class=cp_intrucoes><div align="center">Instru��es de Impress�o</div></td></tr>
			    <TR>
			        <TD valign=top class=cp_intrucoes><DIV ALIGN="left">
			            <p>
			                <li>Imprima em impressora jato de tinta (ink jet) ou laser em qualidade normal ou alta (N�o use modo econ�mico).
			                <li>Utilize folha A4 (210 x 297 mm) ou Carta (216 x 279 mm) e margens m�nimas � esquerda e � direita do formul�rio.
			                <li>Corte na linha indicada. N�o rasure, risque, fure ou dobre a regi�o onde se encontra o c�digo de barras.
			                <li>Caso n�o apare�a o c�digo de barras no final, clique em F5 para atualizar esta tela.
			                <li>Caso tenha problemas ao imprimir, copie a seq�encia num�rica abaixo e pague no caixa eletr�nico ou no internet banking:
			</table>
			<BR>
			<table style="border-collapse: collapse;border-spacing: 0;">
			 <tr>
			    <td class=cp align=right width=705 >Recibo do Sacado</td>
			 </tr>
			</table>
			<table style="border-collapse: collapse;border-spacing: 0;">
			    <tr>
			        <td class=cp width=150><span class="campo"><IMG src="'.URL_IMG.'/boletos/logosantander.jpg" width="150" height="40" border=0></span></td>
			        <td width=3 valign=bottom><img height=22 src='.URL_IMG.'/boletos/3.png width=2 border=0></td>
			        <td class=cpt width=58 valign=bottom><div align=center><font class=bc>' .$this->prepara_dados_boletos["codigo_banco_com_dv"]. '</font></div></td>
			        <td width=3 valign=bottom><img height=22 src='.URL_IMG.'/boletos/3.png width=2 border=0></td>
			        <td class=ld align=right width=453 valign=bottom><span class=ld> <span class="campotitulo"> ' .$this->prepara_dados_boletos["linha_digitavel"]. ' </span></span></td>
			    </tr>
			    <tbody>
			    <tr>
			        <td colspan=5><img height=1 src='.URL_IMG.'/boletos/2.png width=704 border=0></td>
			    </tr>
			    </tbody>
			</table>
			<table style="border-collapse: collapse;border-spacing: 0;">
			    <tbody>
			    <tr>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=298 height=13>Cedente</td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=126 height=13>Ag�ncia/C�digo do Cedente</td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=34 height=13>Esp�cie</td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=53 height=13>Quantidade</td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=120 height=13>Nosso n�mero</td>
			    </tr>
			    <tr>
			        <td class=cp valign=top width=298 height=12><span class="campo">' .$this->prepara_dados_boletos["cedente"] . '</span></td>
			        <td class=cp valign=top width=126 height=12><span class="campo"> ' .$this->prepara_dados_boletos["agencia_codigo"] . ' </span></td>
			        <td class=cp valign=top width=34 height=12><span class="campo"> ' .$this->prepara_dados_boletos["especie"] . ' </span></td>
			        <td class=cp valign=top width=53 height=12><span class="campo"> ' .$this->prepara_dados_boletos["quantidade"] . ' </span></td>
			        <td class=cp valign=top align=right width=160 height=12><span class="campo"> ' .$this->prepara_dados_boletos["nosso_numero"] . ' </span></td>
			    </tr>
			    <tr>
			        <td colspan=10 ><img height=1 src='.URL_IMG.'/boletos/2.png width=704 border=0></td>
			    </tr>
			    </tbody>
			</table>
			<table style="border-collapse: collapse;border-spacing: 0;">
			    <tbody>
			    <tr>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=120 height=13>N�mero do documento</td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=132 height=13>CPF/CNPJ</td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=134 height=13>Emiss�o</td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=134 height=13>Vencimento</td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=150 height=13>Valor documento</td>
			    </tr>
			    <tr>
			        <td class=cp valign=top width=120 height=12><span class="campo"> ' .$this->prepara_dados_boletos["numero_documento"] . ' </span></td>
			        <td class=cp valign=top width=132 height=12><span class="campo"> ' .$this->prepara_dados_boletos["cpf_cnpj"] . ' </span></td>
			        <td class=cp valign=top width=134 height=12><span class="campo"> ' .$this->prepara_dados_boletos["data_documento"] . ' </span></td>
			        <td class=cp valign=top width=134 height=12><span class="campo"> ' .$this->prepara_dados_boletos["data_vencimento"] . ' </span></td>
			        <td class=cp valign=top align=right width=150 height=12><span class="campo"> ' .$this->prepara_dados_boletos["valor_cobrado"] . ' </span></td>
			    </tr>
			    <tr>
			        <td colspan=10><img height=1 src='.URL_IMG.'/boletos/2.png width=704 border=0></td>
			    </tr>
			    </tbody>
			</table>
			<table style="border-collapse: collapse;border-spacing: 0;">
			    <tbody>
			    <tr>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=120 height=13>(-) Desconto / Abatimentos</td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=112 height=13>(-) Outras dedu��es</td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=113 height=13>(+) Mora / Multa</td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=113 height=13>(+) Outros acr�scimos</td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=180 height=13>(=) Valor cobrado</td>
			    </tr>
			    <tr>
			        <td class=cp valign=top width=120 height=13><span class="campo"> </span></td>
			        <td class=cp valign=top width=112 height=13 align=right><span class="campo"> '.$this->prepara_dados_boletos["valor_desconto"] .'</span></td>
			        <td class=cp valign=top width=113 height=13 align=right><span class="campo"> '.$this->prepara_dados_boletos["taxa_boleto"] .' </span></td>
			        <td class=cp valign=top width=113 height=13><span class="campo"> </span></td>
			        <td class=cp valign=top width=210 height=13 align=right ><span class="campo"> '.$this->prepara_dados_boletos["valor_boleto"] .'</span></td>
			    </tr>
			    <tr>
			        <td colspan=10><img height=1 src='.URL_IMG.'/boletos/2.png width=704 border=0></td>
			    </tr>
			    </tbody>
			</table>
			<table style="border-collapse: collapse;border-spacing: 0;">
			    <tbody>
			    <tr>
			        <td class=ct valign=top width=7 height=26 rowspan=2 ><img height=49 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=659 height=13>Sacado</td>
			    </tr>
			    <tr>
			        <td class=cp valign=top width=659 height=26> <span class="campo"> '.$this->prepara_dados_boletos["sacado"].' <br>  '.$this->prepara_dados_boletos["endereco_cliente"]. ' <br> CGC: '.$this->prepara_dados_boletos["cnpj"]. '</span></td>
			    </tr>
			    <tr>
			        <td colspan=10><img height=1 src='.URL_IMG.'/boletos/2.png width=704 border=0></td>
			    </tr>
			    </tbody>
			</table>
			<table style="border-collapse: collapse;border-spacing: 0;">
			    <tbody>
			    <tr>
			        <td class=ct width=7 height=12></td>
			        <td class=ct width=400>Demonstrativo</td>
			        <td class=ct width=7 height=12></td>
			        <td class=ct width=130>Autentica��o mec�nica</td>
			    </tr>
			    <tr>
			        <td width=7></td>
			        <td class=cp width=564><span class="campo"> ' .$this->prepara_dados_boletos["demonstrativo1"] . '<br> ' .$this->prepara_dados_boletos["demonstrativo2"] . '<br>' .$this->prepara_dados_boletos["demonstrativo3"] . '<br><br>'.$this->prepara_dados_boletos["demonstrativo4"] .'<br>' ;for($i=0;$i <= count($this->prepara_dados_boletos["demonstrativo5"]);$i++){
        $html .= $this->prepara_dados_boletos["demonstrativo5"][$i].'<br>';
    }
        $html.= '</span></td>
			        <td width=7></td>
			        <td width=88></td>
			    </tr>
			    </tbody>
			</table>
			<table style="border-collapse: collapse;border-spacing: 0;">
			    <tbody>
			    <tr>
			        <td width=7></td>
			        <td width=500 class=cp><br><br><br></td>
			        <td width=159></td>
			    </tr>
			    </tbody>
			</table>
			<table style="border-collapse: collapse;border-spacing: 0;">
			    <tr>
			        <td class=ct width=666></td>
			    </tr>
			    <tbody>
			    <tr>
			        <td class=ct width=666>
			            <div align=right>Corte na linha pontilhada</div>
			        </td>
			    </tr>
			    <tr>
			        <td class=ct colspan=10><img height=1 src='.URL_IMG.'/boletos/6.png width=704 border=0></td>
			    </tr>
			    </tbody>
			</table>
			<br>
			<table style="border-collapse: collapse;border-spacing: 0;">
			    <tr>
			        <td class=cp width=150><span class="campo"><IMG src="'.URL_IMG.'/boletos/logosantander.jpg" width="150" height="40" border=0></span></td>
			        <td width=3 valign=bottom><img height=22 src='.URL_IMG.'/boletos/3.png width=2 border=0></td>
			        <td class=cpt width=58 valign=bottom><div align=center><font class=bc>' .$this->prepara_dados_boletos["codigo_banco_com_dv"] . '</font></div></td>
			        <td width=3 valign=bottom><img height=22 src='.URL_IMG.'/boletos/3.png width=2 border=0></td>
			        <td class=ld align=right width=453 valign=bottom><span class=ld> <span class="campotitulo"> ' .$this->prepara_dados_boletos["linha_digitavel"] . ' </span></span>
			        </td>
			    </tr>
			    <tbody>
			    <tr>
			       <td colspan=10><img height=1 src='.URL_IMG.'/boletos/2.png width=704 border=0></td>
			    </tr>
			    </tbody>
			</table>
			<table style="border-collapse: collapse;border-spacing: 0;">
			    <tbody>
			    <tr>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=501 height=13>Local de Pagamento</td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=150 height=13>Vencimento</td>
			    </tr>
			    <tr>
			        <td class=cp valign=top width=500 height=12>' .$this->prepara_dados_boletos["local_pagamento"]. '</td>
			        <td class=cp valign=top align=right width=190 height=12><span class="campo"> ' .$this->prepara_dados_boletos["data_vencimento_nova"] . ' </span></td>
			    </tr>
			    <tr>
			        <td colspan=10><img height=1 src='.URL_IMG.'/boletos/2.png width=704 border=0></td>
			    </tr>
			    </tbody>
			</table>
			<table style="border-collapse: collapse;border-spacing: 0;">
			    <tbody>
			    <tr>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=501 height=13>Cedente</td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1border=0></td>
			        <td class=ct valign=top width=150 height=13>Ag�ncia/C�digo Cedente</td>
			    </tr>
			    <tr>
			        <td class=cp valign=top width=472 height=12><span class="campo"> ' .$this->prepara_dados_boletos["cedente"] . ' </span></td>
			        <td class=cp valign=top align=right width=190 height=12><span class="campo"> ' .$this->prepara_dados_boletos["agencia_codigo"] . ' </span></td>
			    </tr>
			    <tr>
			        <td colspan=10><img height=1 src='.URL_IMG.'/boletos/2.png width=704 border=0></td>
			    </tr>
			    </tbody>
			</table>
			<table style="border-collapse: collapse;border-spacing: 0;">
			    <tbody>
			    <tr>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=113 height=13>Data do Documento</td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=153 height=13>N� Documento</td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=62 height=13>Esp�cie Doc.</td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=34 height=13>Aceite</td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=111 height=13>Data Processamento </td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=150 height=13> Nosso N�mero</td>
			    </tr>
			    <tr>
			        <td class=cp valign=top width=113 height=12> <div align=left><span class="campo">' .$this->prepara_dados_boletos["data_documento"] . ' </span></div> </td>
			        <td class=cp valign=top width=153 height=12>  <div align=left><span class="campo">' .$this->prepara_dados_boletos["numero_documento"] . ' </span></div></td>
			        <td class=cp valign=top width=62 height=12>  <div align=left><span class="campo">' .$this->prepara_dados_boletos["especie_doc"] . '  </span></div></td>
			        <td class=cp valign=top width=34 height=12>  <div align=left><span class="campo">' .$this->prepara_dados_boletos["aceite"] . ' </span></div></td>
			        <td class=cp valign=top width=82 height=12>  <div align=left><span class="campo">' .$this->prepara_dados_boletos["data_processamento"] . ' </span></div></td>
			        <td class=cp valign=top align=right width=190 height=12><span class="campo">' .$this->prepara_dados_boletos["nosso_numero"] . '</span></td>
			    </tr>
			    <tr>
			        <td colspan=12><img height=1 src='.URL_IMG.'/boletos/2.png width=704 border=0></td>
			    </tr>
			    </tbody>
			</table>
			<table style="border-collapse: collapse;border-spacing: 0;">
			    <tbody>
			    <tr>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=83 height=13> Uso do Banco </td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=83 height=13> Carteira</td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=53 height=13> Esp�cie</td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=123 height=13> Quantidade</td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=131 height=13>Valor Documento</td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=180 height=13> (=) Valor Documento</td>
			    </tr>
			    <tr>
			        <td valign=top class=cp width=83 height=12 ><div align=left></div></td>
			        <td class=cp valign=top width=83><div align=left> <span class="campo">' .$this->prepara_dados_boletos["carteira"] . '</span></div></td>
			        <td class=cp valign=top width=53><div align=left><span class="campo">' .$this->prepara_dados_boletos["especie"] . '</span></div></td>
			        <td class=cp valign=top width=123><span class="campo">' .$this->prepara_dados_boletos["quantidade"] . ' </span></td>
			        <td class=cp valign=top width=131><span class="campo">' .$this->prepara_dados_boletos["valor_unitario"] . '</span></td>
			        <td class=cp valign=top align=right width=190 height=12><span class="campo">' .$this->prepara_dados_boletos["valor_cobrado"] . '</span></td>
			    </tr>
			    <tr>
			        <td colspan=12><img height=1 src='.URL_IMG.'/boletos/2.png width=704 border=0></td>
			    </tr>
			    </tbody>
			</table>

			<table style="border-collapse: collapse;border-spacing: 0;">
			<tbody>
			    <tr>
			        <td class=ct valign=top width=20 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=488 height=13></td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=83 height=13> Carteira</td>
			    </tr>
			    <tr>

			        <td valign=top width=400 rowspan=5><font class=ct> Instru��es (Texto de responsabilidade do cedente)</font>
			        </td>
			        <td valign=top class=cp width=190 height=12 align=right >'.$this->prepara_dados_boletos["carteira"].'</td>
			    </tr>
			    </tbody>
			</table>

			<table style="border-collapse: collapse;border-spacing: 0;">
			<tbody>
			    <tr>
			        <td class=ct valign=top width=20 height=13 rowspan=2><img height=10 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td width=488 ></td>
			        <td class=ct valign=top height=13 rowspan=2><img height=10 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td><img height=1 src='.URL_IMG.'/boletos/2.png width=192 border=0></td>
			    </tr>
			</tbody>
			</table>


			<table style="border-collapse: collapse;border-spacing: 0;">
			<tbody>
			    <tr>
			        <td class=ct valign=top width=20 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=488 height=13><span class=cp> <FONT class=campo>' .$this->prepara_dados_boletos["instrucoes1"] . '</FONT></span></td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=83 height=13>(-)Outras Dedu��es</td>
			    </tr>
			    <tr>
			        <td valign=top width=400 rowspan=5><span class=cp> <FONT class=campo>' .$this->prepara_dados_boletos["instrucoes2"] . '</FONT></span></td>
			        <td valign=top class=cp width=83 height=12 ><span class=cp></span></td>
			        <td valign=top class=cp width=107 height=12 align=right><span class=cp> '.$this->prepara_dados_boletos["valor_desconto"] .'</span></td>
			    </tr>

			</tbody>
			</table>

			<table style="border-collapse: collapse;border-spacing: 0;">
			<tbody>
			    <tr>
			        <td class=ct valign=top width=20 height=13 rowspan=2><img height=10 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td width=488 ></td>
			        <td class=ct valign=top height=13 rowspan=2><img height=10 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td><img height=1 src='.URL_IMG.'/boletos/2.png width=192 border=0></td>
			    </tr>
			</tbody>
			</table>

			<table style="border-collapse: collapse;border-spacing: 0;">
			<tbody>
			    <tr>
			        <td class=ct valign=top width=20 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=488 height=13><span class=cp> <FONT class=campo>' .$this->prepara_dados_boletos["instrucoes3"] . '</FONT></span></td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=83 height=13> (+) Mora/Multa</td>
			    </tr>
			    <tr>

			        <td valign=top width=400 rowspan=5><span class=cp> <FONT class=campo>' .$this->prepara_dados_boletos["instrucoes4"] . '</FONT></span></td>
			        <td valign=top class=cp width=188 height=12 align=right > ' .$this->prepara_dados_boletos["taxa_boleto"].'</td>
			    </tr>

			</tbody>
			</table>

			<table style="border-collapse: collapse;border-spacing: 0;">
			<tbody>
			    <tr>
			        <td class=ct valign=top width=20 height=13 rowspan=2><img height=10 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td width=488 ></td>
			        <td class=ct valign=top height=13 rowspan=2><img height=10 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td><img height=1 src='.URL_IMG.'/boletos/2.png width=192 border=0></td>
			    </tr>
			</tbody>
			</table>


			<table style="border-collapse: collapse;border-spacing: 0;">
			<tbody>
			    <tr>
			        <td class=ct valign=top width=20 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=488 height=13></td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=100 height=13> (+) Outros Acr�scimos</td>
			    </tr>
			    <tr>
			        <td valign=top width=400 rowspan=5></td>
			        <td valign=top class=cp width=83 height=12 ></td>
			    </tr>

			</tbody>
			</table>

			<table style="border-collapse: collapse;border-spacing: 0;">
			<tbody>
			    <tr>
			        <td class=ct valign=top width=20 height=13 rowspan=2><img height=10 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td width=488 ></td>
			        <td class=ct valign=top height=13 rowspan=2><img height=10 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td><img height=1 src='.URL_IMG.'/boletos/2.png width=192 border=0></td>
			    </tr>
			</tbody>
			</table>


			</table>

			<table style="border-collapse: collapse;border-spacing: 0;">
			<tbody>
			    <tr>
			        <td class=ct valign=top width=20 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=488 height=13><span class=cp> <FONT class=campo>' .$this->prepara_dados_boletos["instrucoes5"] . '</FONT></span></td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=29 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=100 height=13> (=) Valor Cobrado</td>
			    </tr>
			    <tr>

			        <td valign=top width=400 rowspan=5></td>
			        <td valign=top class=cp width=190 height=12 align=right >'.$this->prepara_dados_boletos["valor_boleto"].'</td>
			    </tr>
			</tbody>
			</table>


			<table style="border-collapse: collapse;border-spacing: 0;">
			<tbody>
			    <tr>
			        <td colspan=12><img height=1 src='.URL_IMG.'/boletos/2.png width=704 border=0></td>
			    </tr>
			</tbody>
			</table>

			<table style="border-collapse: collapse;border-spacing: 0;">
			<tbody>
			    <tr>
			        <td class=ct valign=top width=20 height=13 rowspan=2><img height=49 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=488 height=13>Sacado</td>
			        <td class=ct valign=top width=7 height=13 rowspan=2><img height=49 src='.URL_IMG.'/boletos/1.png width=1 border=0></td>
			        <td class=ct valign=top width=100 height=13></td>
			    </tr>
			    <tr>
                <td class=cp valign=top width=450 height=26> <span class="campo"> '.$this->prepara_dados_boletos["sacado"].' <br>  '.$this->prepara_dados_boletos["endereco_cliente"]. ' <br> CGC: '.$this->prepara_dados_boletos["cnpj"]. '</span></td>
                <td valign=top class=cp width=88 height=12 ></td>
			    </tr>
			</tbody>
			</table>


			<table style="border-collapse: collapse;border-spacing: 0;">
			<tbody>
			    <tr>
			        <td colspan=12><img height=1 src='.URL_IMG.'/boletos/2.png width=704 border=0></td>
			    </tr>
			</tbody>
			</table>
			<table style="border-collapse: collapse;border-spacing: 0;">
			<tbody>
			    <tr>
			        <td class=ct valign=top width=515 height=13>Sacador/Avalista</td>
			        <td class=ct valign=top width=100 height=13>C�d. Baixa</td>
			    </tr>
			    <tr>
			        <td valign=top width=400 rowspan=5></td>
			        <td valign=top class=cp width=83 height=12 ></td>
			    </tr>
			</tbody>
			</table>
			<br>
			<table style="border-collapse: collapse;border-spacing: 0;">
			    <TBODY>
			    <TR>
			        <TD vAlign=bottom align=left height=50> ' . $this->fbarcode($this->prepara_dados_boletos["codigo_barras"]) . '
			        </TD>
			    </tr>
			    </tbody>
			</table>
			<br>
			<table style="border-collapse: collapse;border-spacing: 0;">
			<body>
			    <tr>
			        <td class=ct colspan=10><img height=1 src='.URL_IMG.'/boletos/6.png width=704 border=0></td>
			    </tr>
			    </tbody>
			</table>
			</BODY>';

        return $html;
    }
}